<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("basePath", basePath);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'Page.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<jsp:include page="/scripts/common/index.html"></jsp:include>
<jsp:include page="/scripts/jquery/index.html"></jsp:include>
<jsp:include page="/scripts/dhtmlx/index.html"></jsp:include>
<jsp:include page="/scripts/bootstrap/index.html"></jsp:include>
<link rel="stylesheet" href="${basePath }style/default.css">
<script>
	var myGrid;
	var data = [
			[
					"100" ,
					"A Time to Kill" ,
					"John Grisham" ,
					"12.99" ,
					"1" ,
					"05/01/1998"
			] ,
			[
					"1000" ,
					"Blood and Smoke" ,
					"Stephen King" ,
					"0" ,
					"1" ,
					"01/01/2000"
			] ,
			[
					"1000" ,
					"Blood and Smoke" ,
					"Stephen King" ,
					"0" ,
					"1" ,
					"01/01/2000"
			]
	];
	function init() {
		clickFun();
		addNode();
	}
	function addNode() {
		var str = "<div id='example5' class='ezmodal'></div><input type='text' id='sucessUrl' style='display:none'/>";
		$("body").append(str);
	}
	function clickFun() {
		//新增
		$("#add").click(function() {
			SN.getWindowByUrl("新增XXX", "800", "400", "${basePath}page/model/Page/toAdd", {});
		});
		//修改
		$("#update").click(function() {
			SN.getWindowByUrl("修改XXX", "800", "400", "${basePath}page/model/Page/toUpd", {});
		});
		//浏览
		$("#view").click(function() {
			SN.getWindowByUrl("浏览XXX", "800", "400", "${basePath}page/model/Page/toView", {});
		});
		//高级查询
		$("#query").click(function() {
			SN.getWindowByUrl("高级查询", "800", "400", "${basePath}page1/system/AdvanceQuery.jsp", {});
		});
		//多页添加页面
		// 		$("#addMore").click(function(){
		// 			SN.getWindowByUrl("新增XXX","800","470","${basePath}page1/system/PageMore_Add.jsp",{});
		// 		});
		//上传
		// 		$("#upload").click(function(){
		// 			SN.getWindowByUrl("上传","800","470","${basePath}common/FileUpload.jsp",{});
		// 		});
		//下载
		// 		$("#download").click(function(){
		// 			SN.getWindowByUrl("上传","800","470","${basePath}common/FileDownload.jsp",{});
		// 		});
		//删除
		$("#delete").click(function() {
			SN.alert.confirm("是否要删除数据！", function(obj) {
				if (obj) {
					alert("代码")
				}
			});
		});
		//重置
		$("#repeat").click(function() {
			window.location.reload();
		});
		//刷新
		$("#refresh").click(function() {
			query();
		});
		//从表新增
		$("#add_Statement").click(function() {
			SN.getWindowByUrl("新增XXX", "800", "400", "${basePath}page/model/Page/toAdd", {});
		});
		//从表修改
		$("#update_Statement").click(function() {
			SN.getWindowByUrl("修改XXX", "800", "400", "${basePath}page/model/Page/toUpd", {});
		});
		//从表删除
		$("#delete_Statement").click(function() {
			SN.alert.confirm("是否要删除数据！", function(obj) {
				if (obj) {
					alert("代码")
				}
			});
		});
	}
	function query() {
		$.ajax({
			type : 'POST' ,
			url : 'page/model/Page/query' ,
			data : getValue() ,
			dataType : "json" ,
			async : true ,
			cache : false ,
			jsonpCallback : "null" ,
			//beforeSend : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			//dataFilter : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			success : function(response, status, statusText) {
				console.debug(response);
				if (response.status) {
					var a = response.content.currentPageNum;
					var b = response.content.allPageNum;
					var c = response.content.allCount;
					setValue(a, b, c);
				} else {
					alert();
				}
			} ,
			error : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			} ,
			complete : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			}
		});
		$.ajax({
			type : 'POST' ,
			url : 'page/model/Page/query' ,
			data : getValue2() ,
			dataType : "json" ,
			async : true ,
			cache : false ,
			jsonpCallback : "null" ,
			//beforeSend : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			//dataFilter : function(response, status, statusText) {
			//alert(response + ":" + status + ":" + statusText);
			//} ,
			success : function(response, status, statusText) {
				console.debug(response);
				if (response.status) {
					var a = response.content.currentPageNum;
					var b = response.content.allPageNum;
					var c = response.content.allCount;
					setValue2(a, b, c);
				} else {
					alert();
				}
			} ,
			error : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			} ,
			complete : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			}
		});
	}
</script>
</head>
<body onload="init()">
	<table class="listTableClass" border="0" cellpadding="0" cellspacing="0">
		<tr class="queryClass">
			<td>
				<table style="width:98%;margin-left:15px;" border="0">
					<tr>
						<td style="width:5%">姓名：</td>
						<td style="width:20%"><input type="text" class="form-control"></td>
						<td>
							<button onclick="query()" class="btn btn-primary" type="button">
								<span>查询</span>
							</button>
							<button class="btn btn-primary" type="reset">
								<span>清空</span>
							</button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="listTrClass">
			<td valign="top">
				<table class="listTableClass">
					<tr class="listContClass">
						<td>
							<div>
								<button class="btn btn-primary" id="add">
									<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> &nbsp; <span>新增</span>
								</button>
								<button class="btn btn-primary" id="addChildTable">
									<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> &nbsp; <span>新增主从</span>
								</button>
								<button class="btn btn-primary" id="update">
									<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> &nbsp; <span>修改</span>
								</button>
								<button class="btn btn-primary" id="view">
									<span class="glyphicon glyphicon-file" aria-hidden="true"></span> &nbsp; <span>浏览</span>
								</button>
								<button class="btn btn-primary" id="viewChildTable">
									<span class="glyphicon glyphicon-file" aria-hidden="true"></span> &nbsp; <span>浏览主从</span>
								</button>
								<button class="btn btn-primary" id="delete">
									<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> &nbsp; <span>删除</span>
								</button>
								<button class="btn btn-primary" id="query">
									<span class="glyphicon glyphicon-search" aria-hidden="true"></span> &nbsp; <span>高级查询</span>
								</button>
								<button class="btn btn-primary" id="refresh">
									<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> &nbsp; <span>刷新</span>
								</button>
								<button class="btn btn-primary" id="repeat">
									<span class="glyphicon glyphicon-repeat" aria-hidden="true"></span> &nbsp; <span>重置</span>
								</button>
								<button class="btn btn-primary" id="exportNow">
									<span class="glyphicon glyphicon-export" aria-hidden="true"></span> &nbsp; <span>导出当前页</span>
								</button>
								<button class="btn btn-primary" id="exportAll">
									<span class="glyphicon glyphicon-export" aria-hidden="true"></span> &nbsp; <span>导出全部</span>
								</button>
							</div>
						</td>
					</tr>
					<tr class="listTrClass">
						<td><jsp:include page="/common/grid_toolbar.jsp">
								<jsp:param value="query" name="func" />
								<jsp:param value="setValue" name="setValue" />
								<jsp:param value="getValue" name="getValue" />
								<jsp:param value="getGrid" name="getGrid" />
								<jsp:param value="true" name="isPaging" />
								<jsp:param value="false" name="isCheck" />
							</jsp:include></td>
					</tr>
					<tr class="splitTrClass">
						<td></td>
					</tr>
					<tr class="listContClass">
						<td>
							<div>
								<button class="btn btn-primary" id="add_Statement">
									<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> &nbsp; <span>新增</span>
								</button>
								<button class="btn btn-primary" id="update_Statement">
									<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> &nbsp; <span>修改</span>
								</button>
								<button class="btn btn-primary" id="view">
									<span class="glyphicon glyphicon-file" aria-hidden="true"></span> &nbsp; <span>浏览</span>
								</button>
								<button class="btn btn-primary" id="delete_Statement">
									<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> &nbsp; <span>删除</span>
								</button>
							</div>
						</td>
					</tr>
					<tr class="listTrClass">
						<td><jsp:include page="/common/grid_toolbar.jsp">
								<jsp:param value="query" name="func" />
								<jsp:param value="setValue2" name="setValue" />
								<jsp:param value="getValue2" name="getValue" />
								<jsp:param value="getGrid2" name="getGrid" />
								<jsp:param value="true" name="isPaging" />
							</jsp:include></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>
